package com.shopping.serviceImpl;
import com.shopping.dao.UserDao;
import com.shopping.pojo.User;
import com.shopping.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
@Autowired
    private UserDao userDao;

    @Override
    public List<User> selectUserByQuery(String userName, int start, int limit) {
        return userDao.selectUserByQuery(userName,start,limit);
    }

    @Override
    public int getUserNum(String userName) {
        return userDao.getUserNum(userName);
    }

    @Override
    public User getUserByUserName(String userName) {
        return userDao.getUserByUserName(userName);
    }

    @Override
    public boolean checkTransfereeInfo(String userName, String name, String phone) {
        return userDao.checkTransfereeInfo(userName,name,phone)>0;
    }

    @Override
    public boolean checkUserNameAndPassword(String userName, String password) {
        return userDao.checkUserNameAndPassword(userName,password)>0;
    }

    @Override
    public boolean insertUser(User user) {
        return userDao.insertUser(user)>0;
    }

    @Override
    public boolean checkUserName(String userName) {
        return userDao.checkUserName(userName)>0;
    }

    @Override
    public boolean updatePassword(String userName, String password) {
        return userDao.updatePassword(userName,password)>0;
    }

    @Override
    public boolean checkUserNameAndPhone(String userName, String phone) {
        return userDao.checkUserNameAndPhone(userName,phone)>0;
    }

    @Override
    public boolean updateUser(User user) {
        return userDao.updateUser(user)>0;
    }

    @Override
    public boolean updateUserImage(String userName, String userImage) {
        return userDao.updateUserImage(userName,userImage)>0;
    }

    @Override
    public boolean updateJoinBlackList(Integer userId) {
        return userDao.updateJoinBlackList(userId)>0;
    }

    @Override
    public boolean updateRemoveBlackList(Integer userId) {
        return userDao.updateRemoveBlackList(userId)>0;
    }

    @Override
    public User getUserByUserId(Integer userId) {
        return userDao.getUserByUserId(userId);
    }
}
